/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainScreen.java
 *
 * Created on Feb 4, 2012, 12:03:23 PM
 */

package UI;

import DTO.ControlDTO;
import DTO.PacketDTO;

/**
 *
 * @author Administrator
 */
public class MainScreen extends javax.swing.JFrame {

    private PacketDTO _hourlyReport;
    private ControlDTO _operationWS;
    private ControlDTO _operationAS;

    /** Creates new form MainScreen */
    public MainScreen(PacketDTO _hourlyReport, ControlDTO _operationWS, ControlDTO _operationAS) {
        this._hourlyReport = _hourlyReport;
        this._operationWS = _operationWS;
        this._operationAS = _operationAS;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        login = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("VNI-Cooper", 1, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 0, 0));
        jLabel1.setText("Welcome to Weather Station System");

        login.setText("Login");
        login.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loginActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(210, 210, 210)
                        .addComponent(login))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(61, 61, 61)
                        .addComponent(jLabel1)))
                .addContainerGap(67, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(64, 64, 64)
                .addComponent(jLabel1)
                .addGap(45, 45, 45)
                .addComponent(login)
                .addContainerGap(41, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void loginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginActionPerformed
        this.dispose();
        /*java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new LoginScreen().setVisible(true);
            }
        });*/
        new LoginScreen(this._hourlyReport, this._operationWS, this._operationAS).setVisible(true);
    }//GEN-LAST:event_loginActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
/*
        System.out.println(SystemSign.AdminCenter + CommonString.MainProgram);
        PacketDTO _hourlyReport = new PacketDTO(SystemSign.AdminCenter);
        PacketDTO _trigger = new PacketDTO(SystemSign.AdminCenter);

        ReceiveReportFromWS AC_listen_WS = new ReceiveReportFromWS(SystemSign.AdminCenter, NetConfig.AdmCen_Listen_WeaSys_Port, _hourlyReport);
        Thread t1 = new Thread(AC_listen_WS, SystemSign.AdminCenter + CommonString.ThreadName + 1);
        t1.start();

        ReceiveTriggerFromAS AC_listen_AS = new ReceiveTriggerFromAS(SystemSign.AdminCenter, NetConfig.AdmCen_Listen_AlaSys_Port, _trigger);
        Thread t2 = new Thread(AC_listen_AS, SystemSign.AdminCenter + CommonString.ThreadName + 2);
        t2.start();
*/
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {

//                new MainScreen().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JButton login;
    // End of variables declaration//GEN-END:variables

}
